//防抖函数
type CallbackFn = (item?: any) => void

let timer: number | null = null
function useDebounce(Callback: CallbackFn, delay = 1000) {
  timer && clearTimeout(timer)
  timer = setTimeout(() => {
    Callback && Callback() //当有值才会执行
  }, delay)
}

export default useDebounce
